<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="main" />
        <title>Create</title>         
    </head>
    <body>
        <div class="body">
            <h1>新建運動員</h1>
            
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${personInstance}">
            <div class="errors">
                <g:renderErrors bean="${personInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:form action="save" method="post" >
            	<g:hiddenField name="extra" value="true" />
                <div class="dialog">
                    <table>
                        <tbody>
                         <tr class="prop">
                                <td valign="top" class="sport">
                                    <label for="sport">*運動項目:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:personInstance,field:'sport','errors')}">
                                	<g:select name="sport.id" from="${Sport.list()}" optionKey="id" optionValue="name"/>
                                </td>
                            </tr>  
                            
                             <tr class="prop">
                                <td valign="top" class="nation">
                                    <label for="nation">*國別:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:personInstance,field:'nation','errors')}">
                                	<g:select name="nation.id" from="${Nation.list()}" optionKey="id" optionValue="name"/>
                                </td>
                            </tr>  
                            
                            <tr class="prop">
                                <td valign="top" class="sex">
                                    <label for="sex">*性別:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:personInstance,field:'sex','errors')}">
                                    <g:select name="sex" from="['M', 'F']" />
                                </td>
                            </tr>
                            
                        	<tr class="prop">
                                <td valign="top" class="name">
                                    <label for="name">*name:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:personInstance,field:'name','errors')}">
                                    <input type="text" id="name" name="name" value="${fieldValue(bean:personInstance,field:'name')}"/>
                                </td>
                            </tr>
                            
                             <tr class="prop">
                                <td valign="top" class="surname">
                                    <label for="surname">surname:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:personInstance,field:'surname','errors')}">
                                    <input type="text" id="surname" name="surname" value="${fieldValue(bean:personInstance,field:'surname')}"/>
                                </td>
                            </tr>
                            
                        	<tr class="prop">
                                <td valign="top" class="uid">
                                    <label for="uid">認證號碼:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:personInstance,field:'uid','errors')}">
                                    <input type="text" id="uid" name="uid" value="${fieldValue(bean:personInstance,field:'uid')}"/>
                                </td>
                            </tr> 
                            
                            <tr class="prop">
                                <td valign="top" class="hotel">
                                    <label for="hotel">hotel:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:personInstance,field:'hotel','errors')}">
                                    <input type="text" id="hotel" name="hotel" value="${fieldValue(bean:personInstance,field:'hotel')}"/>
                                </td>
                            </tr>
                            
                            
                            
                            <tr class="prop">
                                <td valign="top" class="category">
                                    <label for="category">類別:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:personInstance,field:'category','errors')}">
                                    <input type="text" id="category" name="category" value="${fieldValue(bean:personInstance,field:'category')}"/>
                                </td>
                            </tr>
                            
                            <tr class="prop">
                                <td valign="top" class="comeDateAt">
                                    <label for="comeDateAt">預計抵達日期:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:activityInstance,field:'comeDateAt','errors')}">
                                    <g:datePicker name="comeDateAt" value="${personInstance?.comeDateAt}" precision="minute" ></g:datePicker>
                                </td>
                            </tr>
                            
                            
                            <tr class="prop">
                                <td valign="top" class="comeAirport">
                                    <label for="comeAirport">抵達機場:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:personInstance,field:'comeAirport','errors')}">
                                	<g:select name="comeAirport.id" from="${Airport.list()}" optionKey="id" optionValue="name"/>
                                </td>
                            </tr>  
                            
                            <tr class="prop">
                                <td valign="top" class="comeFlight">
                                    <label for="comeFlight">抵達班機:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:personInstance,field:'comeFlight','errors')}">
                                    <input type="text" id="comeFlight" name="comeFlight" value="${fieldValue(bean:personInstance,field:'comeFlight')}"/>
                                </td>
                            </tr>
                            
                            
                            <tr class="prop">
                                <td valign="top" class="goDateAt">
                                    <label for="goDateAt">預計離開日期:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:activityInstance,field:'goDateAt','errors')}">
                                    <g:datePicker name="goDateAt" value="${personInstance?.goDateAt}" precision="minute" ></g:datePicker>
                                </td>
                            </tr>
                            
                            
                            <tr class="prop">
                                <td valign="top" class="goAirport">
                                    <label for="goAirport">離開機場:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:personInstance,field:'goAirport','errors')}">
                                	<g:select name="goAirport.id" from="${Airport.list()}" optionKey="id" optionValue="name"/>
                                </td>
                            </tr>  
                            
                            <tr class="prop">
                                <td valign="top" class="goFlight">
                                    <label for="goFlight">離開班機:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:personInstance,field:'goFlight','errors')}">
                                    <input type="text" id="goFlight" name="goFlight" value="${fieldValue(bean:personInstance,field:'goFlight')}"/>
                                </td>
                            </tr>
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><input class="save" type="submit" value="建立" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
